<!DOCTYPE html>
<html>
<head>
    <title>DOM Level 3 Load Save Example</title>
</head>
<body>
    <p>This example is known to work only in Opera.</p>
    <script type="text/javascript">
    
        var implementation = document.implementation;
        var parser = implementation.createLSParser(implementation.MODE_SYNCHRONOUS, null);
        var input = implementation.createLSInput();
        input.stringData = "<root><child/></root>";
        
        var xmldom = parser.parse(input);

        var serializer = implementation.createLSSerializer();
        serializer.domConfig.setParameter("format-pretty-print", true);
        var xml = serializer.writeToString(xmldom);
        alert(xml);

        
    </script>
</body>
</html>
